# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Sebastian LaVine <mail@smlavine.com>
# Contributor: Lance Chen <cyen0312@gmail.com>

pkgname=jo
pkgver=1.9
pkgrel=1
pkgdesc='JSON output from a shell'
arch=('loong64' 'x86_64')
url='https://github.com/jpmens/jo'
license=('GPL2')
depends=('glibc')
makedepends=('git' 'pandoc')
_commit='2cc476178198774ad6bea89be0b9e4ed2d4bf4c5'
source=("$pkgname::git+$url.git#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd "$pkgname"

  git describe --tags | sed 's/^v//'
}

build() {
  cd "$pkgname"

  autoreconf -vfi

  ./configure \
    --prefix=/usr \
    bashcompdir=/usr/share/bash-completion/completions

  make all
}

check() {
  cd "$pkgname"

  make -k check
}

package() {
  cd "$pkgname"

  make DESTDIR="$pkgdir" install

  # TODO: patch in autotools, or just leave as is ...
  cd "$pkgdir/usr/share/bash-completion/completions"
  mv jo.bash jo
}
